import Vue from 'vue'
import axios from 'axios'
import store from '../store/index.js'
const $axios = axios.create({
  headers: {
    'Content-Type': 'application/json',
    'AdminToken':store.state.token
  },
  timeout: 20000
})

Vue.prototype.$get = async (opt) => {
  let res = await $axios.get(opt.url, {
    params: opt.data
  })
  return res.data
}

Vue.prototype.$post = async (opt) => {
  let res = await $axios.post(opt.url, opt.data)
  return res.data
}
